﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.Content;

namespace GBU.Services.Pedometer
{
    public class StepBroadcastReceiver:BroadcastReceiver
    {
        public StepService stepService;

        public StepBroadcastReceiver(StepService stepService)
        {
            this.stepService = stepService;
        }

        public override void OnReceive(Context context, Intent intent)
        {
           if (intent.Action.Equals(Intent.ActionScreenOff))
           {
               stepService.UnRegisterDetector();
               stepService.RegisterDetector();
               stepService.MWakeLock.Release();
               stepService.AcquireWakeLock();
           }
        }
    }
}
